<% title _('Overview') %>
<%= title_actions dashboard_actions %>

<div class="row">
  <% if User.current.widgets.empty? %>
    <div class="col-md-12 ca">
      <%= link_to(_("Get default dashboard widgets"), reset_default_widgets_path, :method => :put, :class=>'btn btn-default') %>
    </div>
  <% else %>
    <div id='dashboard' class="dashboard gridster col-md-12">
      <ul>
        <% User.current.widgets.available.order(:id).each do |widget| %>
          <%= content_tag(:li, widget_data(widget)) do %>
            <div class='widget_control'>
              <a class='remove' data-url='<%= widget_path(widget) %>' onclick='tfm.dashboard.removeWidget(this)' >&times;</a>
            </div>
            <div class="widget <%= widget_class_name(widget).parameterize %>">
              <div data-ajax-url="<%= widget_path(widget, search: params[:search]) %>" data-on-complete="tfm.dashboard.widgetLoaded">
                <%= spinner(_("%s widget loading...") % widget.name) %>
              </div>
            </div>
          <% end %>
        <% end %>
      </ul>
    </div>
  <% end %>
</div>
